<template>
    <!-- 头部 -->
    <div class="headerDiv" :style="{background:backgroundC}">
        <div class="out" @click="goBackHandel" v-if="goback!=0">
            <img src="../assets/img/back.png" alt="">
        </div>
        <div class="out" @click="closeCurrentPaget" v-if="goback==0">
            <img src="../assets/img/back.png" alt="">
        </div>
        <h2>{{ title }}</h2>
        <!--&lt;!&ndash;帮助按钮&ndash;&gt;-->
        <!--<div class="enterprise_help" @click="goHelpHandle()" style="display: none">-->
        <!--<img src="../assets/img/helpph.png" alt="">-->
        <!--</div>-->
    </div>
</template>

<script>
    import {jh} from '../assets/js/jh-jssdk-dev.js'

    export default {
        name: 'Header',
        props: {
            goback: {
                type: String,
                default: '-1'
            },
            title: {
                type: String,
                default: '智慧考试'
            },
            backgroundC: {
                type: String,
                default: '#4992F6'
            }
        },
        methods: {
            // 关闭该容器 goback为 0 时关闭
            closeCurrentPaget() {
                jh.closeCurrentPaget();
            },
            // 返回上一页 goback为 -1 时返回
            goBackHandel() {
                this.$router.go(-1)
            }
        }
    }
</script>

<style scoped>
    .headerDiv {
        width: 100%;
        height: 44px;
        color: rgba(255, 255, 255, 1);
        font-size: 17px;
        font-weight: bold;
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
    }

    .out {
        height: 100%;
        width: 22px;
        display: flex;
        align-items: center;
        margin-left: 10px;
    }

    .out > img {
        width: 22px;
        height: 22px;
    }

    .headerDiv > h2 {
        line-height: 44px;
        text-align: center;
        width: calc(100vw - 64px);
        font-weight: bold;
        font-size: 17px;
        margin: 0;
    }
</style>
